import request from '@/config/axios'

// 轮播图 VO
export interface CarouselVO {
  id: number // 主键
  title: string // 轮播图标题
  sort: number // 排序
  imageUrl: string // 图片地址
}

// 轮播图 API
export const CarouselApi = {
  // 查询轮播图分页
  getCarouselPage: async (params: any) => {
    return await request.get({ url: `/peizhen/carousel/page`, params })
  },

  // 查询轮播图详情
  getCarousel: async (id: number) => {
    return await request.get({ url: `/peizhen/carousel/get?id=` + id })
  },

  // 新增轮播图
  createCarousel: async (data: CarouselVO) => {
    return await request.post({ url: `/peizhen/carousel/create`, data })
  },

  // 修改轮播图
  updateCarousel: async (data: CarouselVO) => {
    return await request.put({ url: `/peizhen/carousel/update`, data })
  },

  // 删除轮播图
  deleteCarousel: async (id: number) => {
    return await request.delete({ url: `/peizhen/carousel/delete?id=` + id })
  },

  // 导出轮播图 Excel
  exportCarousel: async (params) => {
    return await request.download({ url: `/peizhen/carousel/export-excel`, params })
  },
}